function [y]=FDtesteps(ts,D,N,sink)
% FDtesteps(ts,D,N,sink)
% 	Parameters:
% 		ts:	Time series to be shifted
% 		D:	Displacement
% 		N:	Length of kernel
% 		sink:	Filter used.
% 
% 	Outputs:
% 		y	Shifted time series
% 
% 	Purpose of this code:  This is a modification of Fdtest this allows the filter function to be passed
% 	into the function as a parameter.
    
%%
% USAGE: F or F' (depending on sink being passed in)
% hold off

%% set up data
Ndata = length(ts);
x = ts;
y = zeros(1,Ndata);

%% setup filter 
w = getWindow('blackman3',N,.5);

Dadj = D - (N-1)/2; % adjust delay for kernel length

Dint = round(Dadj); % integer portion of delay


k = (-(N-1)/2):1:((N-1)/2); % kernel index
s = (Dadj-Dint)-k; % filter argument
F = (sink(s)).*w;
n = trapz(F);

%% start with integer delay 
y(Dint+1:end) = x(1:end-Dint);

%% do filtering
%for j = 1:length(ts)
%    q = (filter(((j-1).*eps.*F),1,y));
%    y(j) = q(j);
%end
y = filter(F,1,y);
%y = y./n;

end